//
//  YDTitleLab.swift
//  weibo
//
//  Created by 孙亚东 on 16/6/30.
//  Copyright © 2016年 Sunyadong. All rights reserved.
//

import UIKit

class YDTitleLab: UILabel {


    
    override init(frame: CGRect) {
        
        super.init(frame: frame)
        
        
        setupUI()
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
        
        
    }
    
    func setupUI() {

        self.text = ""
        
//        print(self.text)
        
        self.frame = CGRectMake(0, 0, 200, 44)
        
        self.textAlignment = .Center

        self.numberOfLines = 0
        
        let str = "发布微博\n itcast"
        // 创建attributesTitle

        let mutiAttribute = NSMutableAttributedString(string: str)
        
        mutiAttribute.addAttributes([NSForegroundColorAttributeName: UIColor.redColor(), NSFontAttributeName: UIFont.systemFontOfSize(16.0)], range: NSMakeRange(0, 4))
        
        mutiAttribute.addAttributes([NSForegroundColorAttributeName: UIColor.blueColor()], range: NSMakeRange(6, str.characters.count - 6))
        
        self.attributedText =  mutiAttribute
        
//       print(self.attributedText)
        
 
    
    }
    
    
    

}
